import request from '@/utils/request'

// 获取菜品分页列表
export function getDishPage(params) {
  return request({
    url: '/api/dish/page',
    method: 'get',
    params
  })
}

// 获取菜品详情
export function getDishDetail(id) {
  return request({
    url: `/api/dish/${id}`,
    method: 'get'
  })
}

// 新增菜品
export function addDish(data) {
  return request({
    url: '/api/dish',
    method: 'post',
    data
  })
}

// 更新菜品
export function updateDish(data) {
  return request({
    url: '/api/dish',
    method: 'put',
    data
  })
}

// 删除菜品
export function deleteDish(id) {
  return request({
    url: `/api/dish/${id}`,
    method: 'delete'
  })
}

// 更新菜品状态
export function updateDishStatus(id, status) {
  return request({
    url: `/api/dish/status/${id}/${status}`,
    method: 'put'
  })
}

// 获取菜品分类列表
export function getDishCategoryList(params) {
  return request({
    url: '/api/dish/category/list',
    method: 'get',
    params
  })
}
